package itdep.domain.address;

import itdep.domain.NamedEntity;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

/**
 * @author Ivan Khalopik
 * @version $Revision: 47 $ $Date: 2010-07-05 09:28:44 +0000 (Mon, 05 Jul 2010) $
 */
@Entity
@Table(name = "REGION")
public class Region extends NamedEntity {
	public static final String COUNTRY_PROPERTY = "country";

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ID_COUNTRY", nullable = false)
	private Country country;

	@OneToMany(mappedBy = "region")
	private Set<District> districts = new HashSet<District>();

	public Country getCountry() {
		return country;
	}

	public void setCountry(Country country) {
		this.country = country;
	}

	public Set<District> getDistricts() {
		return districts;
	}
}